func findMinArrowShots1(points [][]int) int {
    if len(points) <= 1 {
        return len(points)
    }

    // 按照区间的左边界升序排列
    sort.Slice(points, func(i, j int) bool {
        return points[i][0] < points[j][0]
    })

     res := 1
    // 将第一个区间设置为可射区间
    rangeStart, rangeEnd := points[0][0], points[0][1]

    for i := 1; i < len(points); i++ {
        curr := points[i]
        if curr[0] <= rangeEnd {
            rangeStart = max(rangeStart, curr[0])
            rangeEnd = min(rangeEnd, curr[1])
        } else {
            res++
            rangeStart, rangeEnd = curr[0], curr[1]
        }
    }

    return res
}

func max(a, b int) int {
    if a > b {
        return a
    }
    return b
}

func min(a, b int) int {
    if a < b {
        return a
    }
    return b
}



func findMinArrowShots(points [][]int) int {
    if len(points) <= 1 {
        return len(points)
    }

    // 按照区间的右边界升序排列
    sort.Slice(points, func(i, j int) bool {
        return points[i][1] < points[j][1]
    })

    res := 1
    pos := points[0][1]
    for i := 1; i < len(points); i++ {
        curr := points[i]
        if curr[0] > pos {
            res++
            pos = curr[1]
        }
    }

    return res
}